package com.blockmeta.bbs.businesslibrary.launch;

import com.blockmeta.bbs.baselibrary.base.app.BaseApp;
import com.blockmeta.bbs.baselibrary.utils.SharedPreferenceUtil;
import com.blockmeta.bbs.baselibrary.utils.gson.GsonUtil;
import com.blockmeta.bbs.businesslibrary.pojo.MainTabPOJO;

import java.util.HashMap;
import java.util.Map;


public class navigationYMAL implements IBaseYMAL {
    public static MainTabPOJO sMainTabPOJO;
    @Override
    public Map<String, Object> parser(String content, String env) {
        try {
            sMainTabPOJO = GsonUtil.buildGson().fromJson(content, MainTabPOJO.class);
            SharedPreferenceUtil.putString(BaseApp.getApp(), "navigationYMAL", content);
        } catch (Exception e) {
        }
        return new HashMap<String, Object>();
    }

    public static MainTabPOJO getsMainTabPOJO(){
        if(sMainTabPOJO != null){
            return sMainTabPOJO;
        }else {
            synchronized (navigationYMAL.class) {
                if(sMainTabPOJO == null) {
                    String navigationYMAL = SharedPreferenceUtil.getString(BaseApp.getApp(), "navigationYMAL", "");
                    sMainTabPOJO = GsonUtil.buildGson().fromJson(navigationYMAL, MainTabPOJO.class);
                    return sMainTabPOJO;
                }
            }
        }
        return sMainTabPOJO;
    }
}